package com.smartfarm.domain.command;

import com.smartfarm.domain.equipment.AgriculturalEquipment;
import lombok.RequiredArgsConstructor;
/*具体命令类  封装了启动引擎的操作，
 执行时调用设备的 startEngine，
 撤销时调用 stopEngine。*/

@RequiredArgsConstructor
public class StartEngineCommand implements Command {
    // 定义一个私有变量，类型为AgriculturalEquipment
    private final AgriculturalEquipment equipment;

    // 实现Command接口的execute方法，调用AgriculturalEquipment的startEngine方法
    @Override
    public void execute() {
        equipment.startEngine();
    }

    // 实现Command接口的undo方法，调用AgriculturalEquipment的stopEngine方法
    @Override
    public void undo() {
        equipment.stopEngine();
    }
} 